﻿<navigation:Page x:Class="MVVM_S.Samples.HelpDesk.Views.Ticket" 
		   xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
		   xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
		   xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
		   xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
		   mc:Ignorable="d"
				 xmlns:vm="clr-namespace:MVVM_S.Samples.HelpDesk.ViewModels"
				 xmlns:converters="clr-namespace:MVVM_S.Samples.HelpDesk.Converters"
		   xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
		   d:DesignWidth="640" d:DesignHeight="480"
		   Title="Ticket Page">
	<navigation:Page.Resources>
		<vm:TicketViewModel x:Key="TicketVM" />
		<converters:UserConverter x:Key="UserConverter" />
	</navigation:Page.Resources>
	<Grid x:Name="LayoutRoot" DataContext="{StaticResource TicketVM}">
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="320*" />
			<ColumnDefinition Width="222*" />
			<ColumnDefinition Width="Auto" />
		</Grid.ColumnDefinitions>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="Auto" />
			<RowDefinition Height="244*" />
		</Grid.RowDefinitions>
		<Grid HorizontalAlignment="Stretch"
			  Name="grid1"
			  VerticalAlignment="Stretch"
			  DataContext="{Binding Path=SelectedTicket}"
			  Grid.Row="1">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="*" />
			</Grid.ColumnDefinitions>
			<TextBlock HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="Opened:"
					   VerticalAlignment="Center" />
			<TextBlock Grid.Row="1"
					   HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="User:"
					   VerticalAlignment="Center" />
			<TextBlock Grid.Row="2"
					   HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="Office:"
					   VerticalAlignment="Center" />
			<TextBlock Grid.Row="3"
					   HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="Category:"
					   VerticalAlignment="Center" />
			<TextBlock Grid.Row="4"
					   HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="Updated:"
					   VerticalAlignment="Center"/>
			<TextBlock Grid.Row="5"
					   HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="Updated By:"
					   VerticalAlignment="Center" />
			<TextBlock Grid.Row="6"
					   HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="Status:"
					   VerticalAlignment="Center" />
			<TextBlock Grid.Row="7"
					   HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="Title:"
					   VerticalAlignment="Center" />
			<TextBlock Grid.Row="8"
					   HorizontalAlignment="Right"
					   Margin="6,0,6,0"
					   Text="Escalation Level:"
					   VerticalAlignment="Center" />
			<TextBlock Grid.Column="1"
					 HorizontalAlignment="Stretch"
					   VerticalAlignment="Center"
					 Margin="0,3,6,3"
					 Text="{Binding Opened, StringFormat=g}" />
			<ComboBox Grid.Column="1"
					 Grid.Row="1"
					 HorizontalAlignment="Stretch"
					 VerticalAlignment="Center"
					 Margin="0,3,6,3"
					 SelectedValue="{Binding UserID, Mode=TwoWay}"
					  ItemsSource="{Binding Source={StaticResource LookupsVM}, Path=UserList}" 
					  DisplayMemberPath="DisplayName"
					  SelectedValuePath="UserID"/>
			<ComboBox Grid.Column="1"
					  Grid.Row="2"
					  HorizontalAlignment="Stretch"
					  VerticalAlignment="Center"
					  Margin="0,3,6,3"
					  SelectedValue="{Binding OfficeID, Mode=TwoWay}"
					  ItemsSource="{Binding Source={StaticResource LookupsVM}, Path=OfficeList}"
					  DisplayMemberPath="OfficeName"
					  SelectedValuePath="OfficeID" />
			<ComboBox Grid.Column="1"
					  Grid.Row="3"
					  HorizontalAlignment="Stretch"
					  VerticalAlignment="Center"
					  Margin="0,3,6,3"
					  SelectedValue="{Binding CategoryID, Mode=TwoWay}"
					  ItemsSource="{Binding Source={StaticResource LookupsVM}, Path=CategoryList}"
					  DisplayMemberPath="CategoryName"
					  SelectedValuePath="CategoryID" />
			<TextBlock Grid.Column="1"
					 Grid.Row="4"
					 HorizontalAlignment="Stretch"
					 VerticalAlignment="Center"
					 Margin="0,3,6,3"
					 Text="{Binding Updated, StringFormat=g}" />
			<TextBlock Grid.Column="1"
					 Grid.Row="5"
					 HorizontalAlignment="Stretch"
					 VerticalAlignment="Center"
					 Margin="0,3,6,3"
					 Text="{Binding UpdatedBy, Converter={StaticResource UserConverter}}" />
			<TextBlock Grid.Column="1"
					   Grid.Row="6"
					   HorizontalAlignment="Stretch"
					   VerticalAlignment="Center"
					   Margin="0,3,6,3"
					   Text="{Binding TicketStatus}" />
			<TextBox Grid.Column="1"
					   Grid.Row="7"
					   HorizontalAlignment="Stretch"
					   VerticalAlignment="Center"
					   Margin="0,3,6,3"
					   Text="{Binding Title, Mode=TwoWay}" />
			<ComboBox Grid.Column="1"
					  Grid.Row="8"
					  HorizontalAlignment="Stretch"
					  VerticalAlignment="Center"
					  Margin="0,3,6,3">
				<ComboBoxItem IsSelected="True"
							  Content="0" />
				<ComboBoxItem Content="1" />
				<ComboBoxItem Content="2" />
				<ComboBoxItem Content="3" />
			</ComboBox>
		</Grid>
		<TextBox Grid.Column="1"
				 HorizontalAlignment="Stretch"
				 Margin="12,0,6,0"
				 Name="textBox1"
				 VerticalAlignment="Stretch"
				 HorizontalContentAlignment="Left"
				 VerticalScrollBarVisibility="Auto"
				 Text="{Binding Path=SelectedTicket.Details, Mode=TwoWay}"
				 Grid.Row="1"
				 Grid.ColumnSpan="2" />
		<TextBlock HorizontalAlignment="Left"
				   Margin="2,4,0,0"
				   Name="textBlock1"
				   Text="Information:"
				   FontWeight="Bold"
				   VerticalAlignment="Top" />
		<TextBlock Grid.Column="1"
				   HorizontalAlignment="Left"
				   Margin="2,4,0,0"
				   Name="textBlock2"
				   Text="Details:"
				   FontWeight="Bold"
				   VerticalAlignment="Top" />
		<StackPanel Grid.Column="2"
					HorizontalAlignment="Right"
					Margin="0"
					Name="stackPanel1"
					Orientation="Horizontal"
					VerticalAlignment="Top">
			<Button Command="{Binding Path=CmdSave}">
				<Image Source="/MVVM-S.Samples.HelpDesk;component/images/save.png"  />
			</Button>
			<Button Command="{Binding Path=CmdUndo}">
				<Image Source="/MVVM-S.Samples.HelpDesk;component/images/undo.png"  />
			</Button>
			<Button Command="{Binding Path=CmdDelete}">
				<Image  Source="/MVVM-S.Samples.HelpDesk;component/images/del.png" />
			</Button>			
		</StackPanel>
		<ScrollViewer
			Grid.ColumnSpan="3"
			Margin="20,2,20,6"
			Grid.Row="3" ScrollViewer.VerticalScrollBarVisibility="Auto"
					  >
			<ItemsControl
				ItemsSource="{Binding NoteList}" Height="192" Width="600">
				<ItemsControl.ItemTemplate>
					<DataTemplate>
						<StackPanel Orientation="Vertical">
							<StackPanel Orientation="Horizontal">
								<TextBlock Text="{Binding EnteredBy}" 
									TextWrapping="NoWrap" 
									FontWeight="Bold"/>
								<TextBlock Text=" on "
									TextWrapping="NoWrap"
									FontWeight="Bold" />
								<TextBlock Text="{Binding Entered, StringFormat=d}"
									TextWrapping="NoWrap"
									FontWeight="Bold" />
								<TextBlock Text=" at "
									TextWrapping="NoWrap"
									FontWeight="Bold" />
								<TextBlock Text="{Binding Entered, StringFormat=t}"
									TextWrapping="NoWrap"
									FontWeight="Bold" />
							</StackPanel>
							<TextBlock Text="{Binding Text}" 
								Margin="20,0"
								TextWrapping="Wrap" 
								FontSize="9"/>
						</StackPanel>
					</DataTemplate>
				</ItemsControl.ItemTemplate>
			</ItemsControl>
		</ScrollViewer>
		<TextBlock FontWeight="Bold"
				   HorizontalAlignment="Left"
				   Margin="10,0,0,0"
				   Name="textBlock3"
				   Text="Notes:"
				   VerticalAlignment="Top"
				   Grid.Row="2"/>
		<Button Command="{Binding Path=CmdAddNote}"
				Grid.Row="2"
				Grid.Column="2"
				HorizontalAlignment="Right"
				Margin="0,0,20,0">
			<StackPanel Orientation="Horizontal">
				<Image Source="/MVVM-S.Samples.HelpDesk;component/images/add.png" />
				<TextBlock Text="Add Note" VerticalAlignment="Center" />
			</StackPanel>
		</Button>
		
	</Grid>
</navigation:Page>
